Skip to content

Conversation

@stephprince
Copy link
Contributor

@stephprince stephprince commented Oct 9, 2025

Motivation

Fix #385. Fix #359.

Adds the total number of files scanned to the report and provides a specific message if no issues were detected.

Also fixes an extra file being counted by updating the file path message when check_unique_identifiers is raised. The original issue mentioned maybe displaying the number of directories, but I think this could potentially lead to more confusion with NWB Zarr files. I think check_unique_identifiers is also a slightly unique case that is performed at the folder level before other checks.

todo:

  • add tests
  • update CHANGELOG

@stephprince stephprince marked this pull request as ready for review October 9, 2025 22:38
@stephprince stephprince requested a review from rly October 9, 2025 22:38
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 76.92308% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.51%. Comparing base (5a8562e) to head (9ab82f3).

Files with missing lines Patch % Lines
src/nwbinspector/_nwbinspector_cli.py 0.00% 7 Missing ⚠️
src/nwbinspector/_formatting.py 83.33% 1 Missing ⚠️
src/nwbinspector/utils/_utils.py 91.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #629      +/-   ##
==========================================
+ Coverage   73.03%   80.51%   +7.47%     
==========================================
  Files          47       47              
  Lines        1587     1606      +19     
==========================================
+ Hits         1159     1293     +134     
+ Misses        428      313     -115     
Files with missing lines Coverage Δ
src/nwbinspector/_dandi_inspection.py 97.95% <100.00%> (+76.80%) ⬆️
src/nwbinspector/_nwb_inspection.py 86.56% <100.00%> (+4.17%) ⬆️
src/nwbinspector/tools/__init__.py 100.00% <100.00%> (ø)
src/nwbinspector/tools/_dandi.py 37.83% <100.00%> (+17.14%) ⬆️
src/nwbinspector/utils/__init__.py 100.00% <ø> (ø)
src/nwbinspector/_formatting.py 69.93% <83.33%> (+46.90%) ⬆️
src/nwbinspector/utils/_utils.py 86.40% <91.66%> (+0.55%) ⬆️
src/nwbinspector/_nwbinspector_cli.py 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

self.nmessages = len(messages)
self.nfiles = len(set(message.file_path for message in messages)) # type: ignore
self.nfiles_with_issues = len(set(message.file_path for message in messages)) # type: ignore
self.nfiles_detected = nfiles_detected if nfiles_detected is not None else self.nfiles_with_issues
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is odd to me. Could we just make nfiles_detected required? I suppose that is a breaking change. Are there other reasons not to make it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of the case when a user is calling the format_messages function directly in the Python API and it feels like an extra unnecessary step to ask them to calculate and provide the n_files_detected. The CLI automatically calculates it for all potential cases.

Maybe it would be best to keep optional, but if nfiles_detected is not provided then just do not add any text about the number of files scanned to the output message since listing n_files_with_issues is potentially misleading?

Copy link
Contributor

@rly rly Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I like your suggestion and would prefer that.

The current phrasing without the number of files detected is still confusing. The "over N files" suggests those are all of the files that were scanned. Maybe something like "Found N files with issues and M issues total across files." would be clearer? What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Found 0 issues over 0 files [Bug]: File count in output includes directories

4 participants